package com.mp.approvalreq.dao;

import com.mp.approvalreq.entity.Cc;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

/**
 * 抄送记录表
 */
public interface CcDao {

    /**
     * 消除未读未归档红点
     *
     * @param requestId
     * @param companyInfoId
     * @throws SQLException
     */
    void deleteRedPoint(Integer requestId, Integer companyInfoId) throws SQLException;

	void deleteRedPoint(Integer requestId) throws SQLException;

	/**
     * 批量作废用户抄送信息
     *
     * @param requestIds
     * @param companyInfoId
     * @throws SQLException
     */
    void deleteUserCcStatus(List<Integer> requestIds, Integer companyInfoId) throws SQLException;

    /**
     * 作废该审批所有归档记录
     *
     * @param requestId
     * @param companyId
     * @throws SQLException
     */
    void deleteCcByRequestId(Integer requestId, Integer companyId) throws SQLException;

    /**
     * 消除未读未归档的红点
     *
     * @param companyInfoId
     * @throws SQLException
     */
    void removeUnFileAndUnReadRequests(Integer companyInfoId) throws SQLException;


    /**
     * 将这条审批的抄送记录标记为 [待归档]
     *
     * @param requestId
     * @param companyId
     * @throws SQLException
     */
    void letCcCouldFile(Integer requestId, Integer companyId) throws SQLException;

    /**
     * 将这条审批的抄送记录标记为 [无需归档] （撤回批准时调用）
     *
     * @param requestId
     * @param companyId
     * @throws SQLException
     */
    void letCcCouldNotFile(Integer requestId, Integer companyId) throws SQLException;

    /**
     * 获取我已归档且有红点的审批ids
     *
     * @param redPointRequestIds
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> getMyArchivedHasRedPointRequestIds(String redPointRequestIds, Integer companyInfoId) throws SQLException;

    /**
     * 获取需要我归档的审批ids
     *
     * @param companyId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> getNeedToFileRequestIds(Integer companyId, Integer companyInfoId) throws SQLException;


    /**
     * 查询需要我归档的审批id集合
     *
     * @param companyId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> selectNeedToFileRequestIds(Integer companyId, Integer companyInfoId) throws SQLException;

    /**
     * 查询我归档的审批id集合
     *
     * @param companyId
     * @param companyInfoId
     * @param orderBy
     * @return
     * @throws SQLException
     */
    List<Integer> selectMyFiledRequestIds(Integer companyId, Integer companyInfoId, String orderBy) throws SQLException;

    /**
     * 查询抄送我的未读红点
     *
     * @param companyId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> selectCcUnReadRequestIds(Integer companyId, Integer companyInfoId) throws SQLException;

    /**
     * 批量获取审批归档人信息
     *
     * @param requestIds
     * @return
     * @throws SQLException
     */
    Map<Integer, List<Integer>> selectArchivedCompanyInfoMap(String requestIds) throws SQLException;

    /**
     * 获取所有抄送用户的审批id
     *
     * @param companyId
     * @param companyInfoId
     * @return
     * @throws SQLException
     */
    List<Integer> selectUserCcRequestIds(Integer companyId, Integer companyInfoId) throws SQLException;

    // ===================================新版===================================

    /**
     * 保存抄送人
     *
     * @param ccList
     * @throws SQLException
     */
    void insertBatchCc(List<Cc> ccList) throws SQLException;

    /**
     * 获取抄送人列表
     *
     * @param requestId
     * @return
     * @throws SQLException
     */
    List<Cc> selectCcListByRequestId(Integer requestId) throws SQLException;

    /**
     * 删除抄送人
     *
     * @param cc
     * @throws SQLException
     */
    void deleteCc(Cc cc) throws SQLException;

    /**
     * 批量查询审批抄送人
     *
     * @param requestIds
     * @return
     * @throws SQLException
     */
    Map<Integer, List<Cc>> selectBatchCc(String requestIds) throws SQLException;

    /**
     * 修改抄送状态
     *
     * @param cc
     * @throws SQLException
     */
    void updateCcFiledStatus(Cc cc) throws SQLException;

    /**
     * 批量修改抄送状态
     *
     * @param ccList
     * @throws SQLException
     */
    void updateBatchCcFiledStatus(List<Cc> ccList) throws SQLException;

    List<Cc> selectCcRedPointInfo(Integer requestId, Integer companyInfoId) throws SQLException;

    List<Cc> selectCcRedPointInfo(Integer requestId) throws SQLException;

}
